package com.demo.Thread;

public class ThreadDemo implements Runnable {

	private float d;

	@Override
	public void run() {
		while (!Thread.interrupted()) {
			try {
				Thread.sleep(100);
				System.out.println("I'm counting......");
			} catch (InterruptedException e) {
				//设置状态位
				Thread.currentThread().interrupt();
			}
		}

	}

	public static void main(String[] args) throws InterruptedException {
		ThreadDemo example1 = new ThreadDemo();
		Thread t1 = new Thread(example1);
		t1.start();

		Thread.sleep(800);

		System.out.println("开始中断线程。。。。。。");
		t1.interrupt();
	}
}
